package leetcode.new_wrold;

import java.util.ArrayList;
import java.util.List;

public class T119 {
    public List<Integer> getRow(int rowIndex) {
        List<Integer> ans = new ArrayList<>();
        ans.add(1);
        for (int i = 1; i <=rowIndex; i++) {
            ans.add(1);
            for (int j = i-1; j>0;j--){
                ans.set(j,ans.get(j)+ans.get(j-1));
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        T119 t119 = new T119();
        List<Integer> list = t119.getRow(5);
        for (Integer integer : list) {
            System.out.print(integer+" ");
        }
    }
}
